<?php

declare(strict_types=1);

namespace App\CustHub\Constants;

use App\Common\Constants\AbstractBaseConstants;
use Hyperf\Constants\Annotation\Constants;

#[Constants]
class CrowSendingConstants extends AbstractBaseConstants
{
    /**
     * @Message("创建中")
     */
    public const WAIT_CRATE = -1;

    /**
     * @Message("等待中")
     */
    public const WAIT_SEND = 0;

    /**
     * @Message("发送中")
     */
    public const SENDING = 1;


    /**
     * @Message("已完成")
     */
    public const COMPLETE = 2;

    /**
     * @Message("暂停中")
     */
    public const PAUSE = 3;

    /**
     * @Message("已取消")
     */
    public const CANCEL = 4;


    public static function convertToTaskStatus($status)
    {
        if($status==self::WAIT_CRATE) return FrdCircTaskStatusConstants::CREATING;
        if($status==self::WAIT_SEND) return FrdCircTaskStatusConstants::WAITING;
        if($status==self::SENDING) return FrdCircTaskStatusConstants::EXECUTING;
        if($status==self::COMPLETE) return FrdCircTaskStatusConstants::COMPLETED;
        if($status==self::CANCEL) return FrdCircTaskStatusConstants::CANCELLED;
        if($status==self::PAUSE) return null;
    }
}